import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { Router, useRouterHistory } from 'react-router'
import { createHashHistory } from 'history'
import ReduxToastr, { toastr } from 'react-redux-toastr'
import routes from './routes'
import configureStore from './configureStore'

const store = configureStore();
const appHistory = useRouterHistory(createHashHistory)({queryKey: false});
const confirmOptions = {
    okText: '返回',
    cancelText: '知道了'
};

render(
    <Provider store={store}>
        <div>
            <Router routes={routes} history={appHistory}/>
            <ReduxToastr
                timeOut={5000}
                newestOnTop={true}
                position="top-right" confirmOptions={confirmOptions}/>
        </div>
    </Provider>,
    document.getElementById('appPage')
);

let toastInfoMessage = message => toastr.info(message);
toastInfoMessage('本页面为 React + Redux + react-router示例页面');